package com.xjscrm.console.mapper;

import com.xjscrm.console.dto.chat.ChatTalkRecordQueryDTO;
import com.xjscrm.console.entity.ChatTalkRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author mingyang.chen create in 2024/3/29 13:36
 */
@Mapper
public interface ChatTalkRecordMapper extends CommonMapper<ChatTalkRecord> {

    int deleteByPrimaryKey(Long id);

    int insertSelective(ChatTalkRecord record);

    ChatTalkRecord selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(ChatTalkRecord record);

    ChatTalkRecord selectLastBySessionId(@Param("sessionId") Long talkSessionId);

    ChatTalkRecord selectLastByDeviceUniqueIdAndSessionId(@Param("merId") Long merId, @Param("deviceUniqueId") Long deviceUniqueId, @Param("talkSessionId") Long talkSessionId);

    List<ChatTalkRecord> select(@Param("param") ChatTalkRecordQueryDTO chatTalkRecordQuery);

    ChatTalkRecord selectOne(@Param("param") ChatTalkRecord chatTalkRecord);

    List<ChatTalkRecord> selectList(@Param("merId") Long merId, @Param("ids") List<Long> ids, @Param("talkSessionId") Long talkSessionId);

    Integer countWithNoRead(@Param("merId") Long merId, @Param("talkSessionId") Long talkSessionId, @Param("lastReadTime") Integer lastReadTime);

    void deleteWithTime(@Param("merId") Long merId, @Param("before3DayTimeSecond") int before3DayTimeSecond);

    void updateRecall(Long id);
}